package com.company.基础.Array.ArraysApi;

import java.util.Arrays;

/**
 * 数组工具类使用
 *
 */
public class Method {
    public static void main(String[] args) {
        //1.boolean equals(int[] a,int[] b) 判断两个数组是否相等
        int[] arr1=new int[]{1,3,8,9,2};
        int[] arr2=new int[]{1,10,8,9};
        if (arr1.equals(arr2)){
            System.out.println("true");
        }else {
            System.out.println("false");
        }

        //2.String toString(int[] a) 输出数组信息
        System.out.println(Arrays.toString(arr1));


        //3.void fill(int[] a,int val)将指定的int值分配给指定数组的每一个元素
        Arrays.fill(arr1,4);
        System.out.println(Arrays.toString(arr1));
        //4.void sort(int [] a)
        Arrays.sort(arr2);
        System.out.println(Arrays.toString(arr2));
        //5.int binarySearch(int[] a,int key)
        System.out.println("==================");
        System.out.println(Arrays.binarySearch(arr2,8));
    }
}
